<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="gv-page-container">
  <a [routerLink]="['..']" class="gv-back-link"><small><< Back to Audit Log</small></a>
  <h1>Audit log detail</h1>
  <div class="audit-content" fxLayout="row">
    <form fxLayout="column" fxFlex="70">
      <div class="gv-form-section">
        <mat-chip-list #chipList style="position: absolute; margin-top: -35px; margin-left: -10px;">
          <mat-chip [color]="audit.outcome?.status === 'SUCCESS'? 'accent':'warn'" selected>
            {{audit.outcome?.status}}
          </mat-chip>
        </mat-chip-list>
        <mat-form-field *ngIf="audit.timestamp" appearance="outline" floatLabel="always">
          <mat-label>Timestamp</mat-label>
          <input matInput placeholder="Timestamp" disabled [value]="audit.timestamp | date: 'dd/MM/yyyy HH:mm:ss.sss'">
          <mat-hint>Time of the event</mat-hint>
        </mat-form-field>
        <mat-form-field *ngIf="audit.type" appearance="outline" floatLabel="always">
          <mat-label>Event Type</mat-label>
          <input matInput placeholder="Event Type" disabled [value]="audit.type">
          <mat-hint>Event type</mat-hint>
        </mat-form-field>
        <mat-form-field *ngIf="audit.actor?.displayName" appearance="outline" floatLabel="always">
          <mat-label>Actor</mat-label>
          <input matInput placeholder="Actor" disabled [value]="audit.actor?.displayName">
          <mat-hint>Who triggered the event</mat-hint>
        </mat-form-field>
        <mat-form-field *ngIf="audit.accessPoint?.alternativeId" appearance="outline" floatLabel="always">
          <mat-label>Application</mat-label>
          <input matInput placeholder="Application" disabled [value]="audit.accessPoint?.alternativeId">
          <mat-hint>Which application triggered the event</mat-hint>
        </mat-form-field>
        <mat-form-field *ngIf="audit.accessPoint?.ipAddress" appearance="outline" floatLabel="always">
          <mat-label>IP Address</mat-label>
          <input matInput placeholder="IP Address" disabled [value]="audit.accessPoint?.ipAddress">
          <mat-hint>Remote IP Address</mat-hint>
        </mat-form-field>
        <mat-form-field *ngIf="audit.accessPoint?.ipAddress" appearance="outline" floatLabel="always">
          <mat-label>User Agent</mat-label>
          <input matInput placeholder="User Agent" disabled [value]="audit.accessPoint?.userAgent">
          <mat-hint>Remote Client User Agent</mat-hint>
        </mat-form-field>
      </div>
      <div class="gv-form-section">
        <div class="gv-form-section-title">
          <h5>Details</h5>
          <mat-divider></mat-divider>
        </div>
        <div>
          <codemirror [value]="auditDetails()" [config]="config"></codemirror>
        </div>
      </div>
    </form>
    <div class="gv-page-description" fxFlex>
      <h3>Log details</h3>
      <div class="gv-page-description-content">
        <p>View the detailed properties of the audit log event record.</p>
      </div>
    </div>
  </div>
</div>
